package com.lq.rocketmq.order;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName OrderStep
 * @Description 模拟顺序消费的业务
 * 模拟订单 创建,付款,推送,完成,订单号相同的消息放到同一个队列中,消费时,同一个OrderId获取到的肯定是同一个ID
 * @Author LQ
 * @Date 2021/5/15 22:57
 * @Version 1.0
 */
@Data
public class OrderStep {

    private Long orderId;
    private String desc;

    /**
     * 构建订单集合
     *
     * @return
     */
    public static List<OrderStep> buildOrders() {
        // 1039L:发送创建 付款 推送 完成
        // 1065L:发送创建 付款 推送
        // 7235L:发送创建 付款
        List<OrderStep> orderList = new ArrayList<>();
        OrderStep orderStep = new OrderStep();
        orderStep.setOrderId(1039L);
        orderStep.setDesc("创建");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1065L);
        orderStep.setDesc("创建");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(7235L);
        orderStep.setDesc("创建");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1039L);
        orderStep.setDesc("付款");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1065L);
        orderStep.setDesc("付款");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(7235L);
        orderStep.setDesc("付款");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1039L);
        orderStep.setDesc("推送");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1065L);
        orderStep.setDesc("推送");
        orderList.add(orderStep);

        orderStep = new OrderStep();
        orderStep.setOrderId(1039L);
        orderStep.setDesc("完成");
        orderList.add(orderStep);
        return orderList;
    }
}
